<?php
namespace Home\Model;
use Think\Model;
class EnewsclassModel extends Model
{
    /**
     * 获取所需要的类别数据
     * @param $fields
     * @param $map
     * @param $limit
     * @param $order
     * @return array|mixed
     */
    public function getLists($fields, $map, $limit = '', $order = '')
    {

        $tmp = $this
                ->field($fields)
                ->where($map);

        if(!is_null($limit))
        {
            $tmp = $tmp -> limit($limit);
        }
        if(!is_null($order))
        {
            $tmp = $tmp -> order($order);
        }

        $data = $tmp -> select();

        return $data ? $data : [];
    }
  
    public function getCount($map){
       return $count = $this->where($map)->count();
    }
}